var head = "http://127.0.0.1/system";
var id = -1;
// var head = "justxi.com/system"

layui.use(['element', 'layer'], function(){
    var element = layui.element;
    var layer = layui.layer;
    
    //监听折叠
    element.on('collapse(test)', function(data){
        layer.msg('展开状态：'+ data.show);
    });
});
function getGender(data){
    if(data == 1) return '男';
    if(data == 2) return '女';
}
/**
 * 用于获取id
 */
function getId(){
    // debugger;
    
    $.ajax({
        url:head+"/user/getid",
        type:"post",
        async:false,
        dataType:"json",
        success:function(data){
            // alert(data.data.data);
            flag = true;
            if(data.code == 0){
                id = data.data.data;
            }else{
                id = -1;
            }
        },
        error:function(){
            id = -1;
        }
    })

    return id;
}

function big(img){
    $(img).attr("style","width: 70%; height: auto; margin-left:20px");
    $(img).attr("onclick","small(this)");

}
function small(img){
    $(img).attr("style","width: 30%; height: auto; margin-left:10px");
    $(img).attr("onclick","big(this)");
}
function close(){
    parent.layer.closeAll();
}

function GetQueryString(name){
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
    var r = window.location.search.substr(1).match(reg); 
    if (r != null) return unescape(r[2]); return null; 
}

function getState(id){
    if(id == 0) return "历史";
    if(id == 1) return "未读";
    if(id == 2) return "未处理";
    if(id == 3) return "处理中";
    if(id == 4) return "拒绝";
}